/**
 * 
 */
package com.thor.palmmall.rest.common;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.common.ATotal;
import com.thor.palmmall.spi.basic.STotal;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class ATotalConverter implements Converter<STotal, ATotal> {

  public static ATotalConverter getInstance() {
    if (instance == null)
      instance = new ATotalConverter();
    return instance;
  }

  private static ATotalConverter instance;

  private ATotalConverter() {
  }

  @Override
  public ATotal convert(STotal source) {
    if (source == null) {
      return null;
    }
    ATotal target = new ATotal();
    target.setPrice(source.getPrice());
    target.setQty(source.getQty());
    target.setTotal(source.getTotal());
    return target;
  }

}
